package com.icangya.DAO.impl;

import com.icangya.DAO.IUserWithdrawRecordDAO;
import com.icangya.Utils.SQLUtilt;
import com.icangya.domain.UserWithdrawRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import java.util.List;

import static com.icangya.Value.FootBall.FOOT_PAGE_ROW;


@Repository
public class UserWithdrawRecordDAOImpl extends  BaseDAO<UserWithdrawRecord> implements IUserWithdrawRecordDAO {

    Logger logger = LoggerFactory.getLogger(this.getClass());


    @Override
    public List getUserWithdrawRecordAll(int startPage) {
        String hql=" FROM UserWithdrawRecord uw ";
        String count = "SELECT COUNT(wu) " + hql;
        Long total = (Long) getHibernateTemplate().find(count).get(0);
        return SQLUtilt.getIstance().doPage(getHibernateTemplate(), hql, total, startPage, FOOT_PAGE_ROW);

    }

    @Override
    public List getUserWithdrawRecordByStatus(int status, int startPage) {
        String hql=" FROM UserWithdrawRecord uw where uw.ststua= "+status;
        String count = "SELECT COUNT(wu) " + hql;
        Long total = (Long) getHibernateTemplate().find(count).get(0);
        return SQLUtilt.getIstance().doPage(getHibernateTemplate(), hql, total, startPage, FOOT_PAGE_ROW);
    }
}
